﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Controls;

namespace WeatherPredictionWPF
{
    public static class ControlExtension
    {
        public static void UpdateControlSafe(this Control control,Action code)
        {
            if (!control.Dispatcher.CheckAccess())
            {
                control.Dispatcher.BeginInvoke(code);
            }
            else
            {
                code.Invoke();
            }

        }
        
    }
}
